package com.smh.a07Test1;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws IOException {

        //客户端:多次发送数据
        //服务器:接收多次接收数据，并打印

        Socket socket = new Socket("127.0.0.1", 10001);
        Scanner scanner = new Scanner(System.in);
        OutputStream os = socket.getOutputStream();
        while (true) {

            byte[] bytes = scanner.nextLine().getBytes();
            os.write(bytes);
            if (new String(bytes).equals("666")) {
                break;
            }

        }
        os.close();
        socket.close();

    }
}
